package com.seres.util;

import ch.qos.logback.classic.pattern.ClassicConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;
import lombok.extern.slf4j.Slf4j;

import java.net.InetAddress;

/**
 * @Description : logback输出实例ip工具
 * @Author : 杨松
 * @Date: 2020-06-19 16:48
 */
@Slf4j
public class LogUtils extends ClassicConverter {

    @Override
    public String convert(ILoggingEvent iLoggingEvent) {
        String ip = null;
        try {
            ip= InetAddress.getLocalHost().getHostAddress();
        } catch (Throwable e) {
            log.error("获取ip异常", e.toString());
        }
        return ip;
    }

}
